/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package fr.sorbonne.soa.ws;

import fr.sorbonne.soa.exception.OrderNotFoundException;
import fr.sorbonne.soa.lib.InvoiceToDistributor;
import fr.sorbonne.soa.lib.ManagerDistributorLocal;
import java.util.Date;
import javax.ejb.EJB;
import javax.jws.WebService;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author Nairo
 */
@WebService()
@Stateless()
public class DistributorShipperWS {
    @EJB
    private ManagerDistributorLocal managerDistributorBean;

    /**
     * Web service operation
     */
    @WebMethod(operationName = "sendShipperInvoice")
    public void sendShipperInvoice(@WebParam(name = "invoice")
    InvoiceToDistributor invoice, @WebParam(name = "estimatedShippingDate")
    Date estimatedShippingDate)
    {
       managerDistributorBean.createShipperInvoice(invoice,
               estimatedShippingDate);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "deliverOrder")
    public void deliverOrder(@WebParam(name = "orderId")
    String orderId)  throws OrderNotFoundException {
        managerDistributorBean.setOrderDelivered(orderId);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "receivePayment")
    public void receivePayment(@WebParam(name = "invoice")
    InvoiceToDistributor invoice) {
        managerDistributorBean.receivePayment(invoice);
    }

    /**
     * Web service operation
     */
    @WebMethod(operationName = "sendInvoiceShipperDelayPenalty")
    public void sendInvoiceShipperDelayPenalty(@WebParam(name = "orderId")
    String orderId, @WebParam(name = "dateDelay")
    Date dateDelay) {
        managerDistributorBean.createInvoiceShipperDelayPenalty(orderId, dateDelay);
    }

    
}
